import pymysql

db = pymysql.connect(
    host='localhost',
    port=3306,
    user='root',
    passwd='root',
    db='book'
)


def insert_data(insert_sql,value):
    cursor = db.cursor()
    cursor.execute(insert_sql,value)
    db.commit()
    cursor.close()


def update_sql(update_sql):
    cursor = db.cursor()
    cursor.execute(update_sql)
    db.commit()
    cursor.close()\

def seach_sql(seach_sql):
    cursor = db.cursor()
    cursor.execute(seach_sql)
    result = cursor.fetchall()
    db.commit()
    cursor.close()
    return result

